﻿// -----------------------------------------------------------------------
// <copyright file="Security.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

using System;
using System.Linq;
using DataAccessLayer.Core;

namespace TRS.DataAccessLayer
{
    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public class Security : DataAccessBase
    {
        public bool Login(string userName, string password)
        {
            try
            {
                using (DatabaseContext database = new DatabaseContext())
                {
                    var result = from user in database.Users
                                 where (user.UserName == userName && user.Password == password)
                                 select user;
                    return result.Count() == 1;
                }
            }
            catch (Exception exc)
            {
            }

            return false;
        }
    }
}